
#include <iostream>
#include "hmm.h"
#include <map>
#include "HMM_Helper.h"
#include "Lexicon.h"
#include "TestBench.h"
#include "SpeechRecognizer.h"

using namespace std;

//double viterbi(

int main(int argc, char** argv)
{
	string lexiconPath = "data\\lexicon.txt";
	string hmmPath = "data\\hmms.mmf";

	SpeechRecognizer rec;
	TestBench testBench;
	HMM* hmm = NULL;
	Lexicon* lex = new Lexicon();

	map<string, HMM*> hmmList;

	ifstream myfile(hmmPath);


	if (myfile.is_open())
	{
		while ( myfile.good() )
		{
			
			hmm = new HMM();
			myfile >> *hmm;

			hmmList[hmm->GetLabel()] = hmm;
		}
	}
	else 
	{
		cout << "File not found!" << endl;
	}

	lex->InitLexicon(lexiconPath, hmmList);
	rec.Init(lex);

	testBench.Init(&rec, "data\\wav", "data\\feature_vectors", "data\\label");

	testBench.StartTest("data\\testset.txt");


	myfile.close();
	getchar();

}